package com.example.bookdemo.dao;

import com.example.bookdemo.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserInfoMapper {
    //通过用户名获取密码
    @Select("select * from user_info where delete_flag=0 and user_name=#{userName}")
    UserInfo passwordGetByName(@Param("userName") String userName);

    //新建用户
    @Insert("insert into user_info(user_name,`password`,delete_flag) values (#{userInfo.userName},#{userInfo.password},0)")
    Integer addUser(@Param("userInfo") UserInfo userInfo);

    @Select("select * from  user_info where delete_flag=0 and id=#{userId}")
    UserInfo selectUserInfo(Integer userId);

    Integer updateUserInfo(UserInfo userInfo);
}
